package jackie.programQuestion;

import java.util.Scanner;

/**
 * Created by acer on 2016/3/4.
 */
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while(input.hasNext()){
            int n = input.nextInt();
            int a = input.nextInt();
            for(int i = 0 ;i<n;i++){
                int b = input.nextInt();
                if(b<=a){
                    a+=b;
                }else{
                    a+=Max(a,b);
                }
            }
            System.out.println(a);
        }
    }

    public static int Max(int a,int b){
        while(b!=a){
            if(b>a)
                b=b-a;
            if(a>b)
                a=a-b;
        }
        return b;
    }
}
